package com.zshan.clinic.cms.controller.clinic;


import com.zshan.clinic.admin.entity.dto.ClinicEmpDTO;
import com.zshan.clinic.admin.entity.dto.ResetPasswordDTO;
import com.zshan.clinic.admin.service.clinic.ClinicEmpService;
import com.zshan.clinic.cms.common.core.controller.BaseController;
import com.zshan.clinic.cms.common.core.domain.AjaxResult;
import com.zshan.clinic.cms.common.core.domain.entity.SysUser;
import com.zshan.clinic.common.enums.PasswordChangeSourceEnum;
import com.zshan.clinic.common.enums.YesOrNoEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 诊所信息
 */
@RestController
@RequestMapping("/clinic/emp")
public class ClinicEmpController extends BaseController {


    @Autowired
    private ClinicEmpService clinicEmpService;

    /**
     * 重置管理员密码
     * @param resetPasswordDTO
     * @return
     */
    @PostMapping("/resetPassword")
    public AjaxResult resetPassword(@RequestBody ResetPasswordDTO resetPasswordDTO) {
        SysUser sysUser = getUser();
        resetPasswordDTO.setSource(PasswordChangeSourceEnum.OPERATION_BACKEND.getValue());
        resetPasswordDTO.setUpdateUserId(sysUser.getUserId());
        resetPasswordDTO.setUpdateBy(sysUser.getUserName());
        clinicEmpService.resetPassword(resetPasswordDTO);
        return AjaxResult.success();
    }
}
